%
% Status : main Dynare file
%
% Warning : this file is generated automatically by Dynare
%           from model file (.mod)

tic0 = tic;
% Define global variables.
global M_ options_ oo_ estim_params_ bayestopt_ dataset_ dataset_info estimation_info ys0_ ex0_
options_ = [];
M_.fname = 'modelG';
M_.dynare_version = '5.4';
oo_.dynare_version = '5.4';
options_.dynare_version = '5.4';
%
% Some global variables initialization
%
global_initialization;
M_.exo_names = cell(2,1);
M_.exo_names_tex = cell(2,1);
M_.exo_names_long = cell(2,1);
M_.exo_names(1) = {'eps_g1'};
M_.exo_names_tex(1) = {'eps\_g1'};
M_.exo_names_long(1) = {'eps_g1'};
M_.exo_names(2) = {'eps_g2'};
M_.exo_names_tex(2) = {'eps\_g2'};
M_.exo_names_long(2) = {'eps_g2'};
M_.endo_names = cell(20,1);
M_.endo_names_tex = cell(20,1);
M_.endo_names_long = cell(20,1);
M_.endo_names(1) = {'federalpurchases'};
M_.endo_names_tex(1) = {'federalpurchases'};
M_.endo_names_long(1) = {'federalpurchases'};
M_.endo_names(2) = {'purchases1'};
M_.endo_names_tex(2) = {'purchases1'};
M_.endo_names_long(2) = {'purchases1'};
M_.endo_names(3) = {'purchases2'};
M_.endo_names_tex(3) = {'purchases2'};
M_.endo_names_long(3) = {'purchases2'};
M_.endo_names(4) = {'g1'};
M_.endo_names_tex(4) = {'g1'};
M_.endo_names_long(4) = {'g1'};
M_.endo_names(5) = {'g2'};
M_.endo_names_tex(5) = {'g2'};
M_.endo_names_long(5) = {'g2'};
M_.endo_names(6) = {'y1'};
M_.endo_names_tex(6) = {'y1'};
M_.endo_names_long(6) = {'y1'};
M_.endo_names(7) = {'y2'};
M_.endo_names_tex(7) = {'y2'};
M_.endo_names_long(7) = {'y2'};
M_.endo_names(8) = {'pi1'};
M_.endo_names_tex(8) = {'pi1'};
M_.endo_names_long(8) = {'pi1'};
M_.endo_names(9) = {'pi2'};
M_.endo_names_tex(9) = {'pi2'};
M_.endo_names_long(9) = {'pi2'};
M_.endo_names(10) = {'tau'};
M_.endo_names_tex(10) = {'tau'};
M_.endo_names_long(10) = {'tau'};
M_.endo_names(11) = {'y'};
M_.endo_names_tex(11) = {'y'};
M_.endo_names_long(11) = {'y'};
M_.endo_names(12) = {'g'};
M_.endo_names_tex(12) = {'g'};
M_.endo_names_long(12) = {'g'};
M_.endo_names(13) = {'pi'};
M_.endo_names_tex(13) = {'pi'};
M_.endo_names_long(13) = {'pi'};
M_.endo_names(14) = {'i'};
M_.endo_names_tex(14) = {'i'};
M_.endo_names_long(14) = {'i'};
M_.endo_names(15) = {'c'};
M_.endo_names_tex(15) = {'c'};
M_.endo_names_long(15) = {'c'};
M_.endo_names(16) = {'p_c'};
M_.endo_names_tex(16) = {'p\_c'};
M_.endo_names_long(16) = {'p_c'};
M_.endo_names(17) = {'p2'};
M_.endo_names_tex(17) = {'p2'};
M_.endo_names_long(17) = {'p2'};
M_.endo_names(18) = {'p1'};
M_.endo_names_tex(18) = {'p1'};
M_.endo_names_long(18) = {'p1'};
M_.endo_names(19) = {'g_output'};
M_.endo_names_tex(19) = {'g\_output'};
M_.endo_names_long(19) = {'g_output'};
M_.endo_names(20) = {'pi_c'};
M_.endo_names_tex(20) = {'pi\_c'};
M_.endo_names_long(20) = {'pi_c'};
M_.endo_partitions = struct();
M_.param_names = cell(16,1);
M_.param_names_tex = cell(16,1);
M_.param_names_long = cell(16,1);
M_.param_names(1) = {'n'};
M_.param_names_tex(1) = {'n'};
M_.param_names_long(1) = {'n'};
M_.param_names(2) = {'gy'};
M_.param_names_tex(2) = {'gy'};
M_.param_names_long(2) = {'gy'};
M_.param_names(3) = {'zeta'};
M_.param_names_tex(3) = {'zeta'};
M_.param_names_long(3) = {'zeta'};
M_.param_names(4) = {'gamma'};
M_.param_names_tex(4) = {'gamma'};
M_.param_names_long(4) = {'gamma'};
M_.param_names(5) = {'rho_g1'};
M_.param_names_tex(5) = {'rho\_g1'};
M_.param_names_long(5) = {'rho_g1'};
M_.param_names(6) = {'rho_g2'};
M_.param_names_tex(6) = {'rho\_g2'};
M_.param_names_long(6) = {'rho_g2'};
M_.param_names(7) = {'sigma'};
M_.param_names_tex(7) = {'sigma'};
M_.param_names_long(7) = {'sigma'};
M_.param_names(8) = {'varphi'};
M_.param_names_tex(8) = {'varphi'};
M_.param_names_long(8) = {'varphi'};
M_.param_names(9) = {'beta'};
M_.param_names_tex(9) = {'beta'};
M_.param_names_long(9) = {'beta'};
M_.param_names(10) = {'phi_pi'};
M_.param_names_tex(10) = {'phi\_pi'};
M_.param_names_long(10) = {'phi_pi'};
M_.param_names(11) = {'alpha1'};
M_.param_names_tex(11) = {'alpha1'};
M_.param_names_long(11) = {'alpha1'};
M_.param_names(12) = {'alpha2'};
M_.param_names_tex(12) = {'alpha2'};
M_.param_names_long(12) = {'alpha2'};
M_.param_names(13) = {'eta'};
M_.param_names_tex(13) = {'eta'};
M_.param_names_long(13) = {'eta'};
M_.param_names(14) = {'taylor'};
M_.param_names_tex(14) = {'taylor'};
M_.param_names_long(14) = {'taylor'};
M_.param_names(15) = {'std1'};
M_.param_names_tex(15) = {'std1'};
M_.param_names_long(15) = {'std1'};
M_.param_names(16) = {'std2'};
M_.param_names_tex(16) = {'std2'};
M_.param_names_long(16) = {'std2'};
M_.param_partitions = struct();
M_.exo_det_nbr = 0;
M_.exo_nbr = 2;
M_.endo_nbr = 20;
M_.param_nbr = 16;
M_.orig_endo_nbr = 20;
M_.aux_vars = [];
M_ = setup_solvers(M_);
M_.Sigma_e = zeros(2, 2);
M_.Correlation_matrix = eye(2, 2);
M_.H = 0;
M_.Correlation_matrix_ME = 1;
M_.sigma_e_is_diagonal = true;
M_.det_shocks = [];
M_.surprise_shocks = [];
M_.heteroskedastic_shocks.Qvalue_orig = [];
M_.heteroskedastic_shocks.Qscale_orig = [];
options_.linear = false;
options_.block = false;
options_.bytecode = false;
options_.use_dll = false;
M_.orig_eq_nbr = 20;
M_.eq_nbr = 20;
M_.ramsey_eq_nbr = 0;
M_.set_auxiliary_variables = exist(['./+' M_.fname '/set_auxiliary_variables.m'], 'file') == 2;
M_.epilogue_names = {};
M_.epilogue_var_list_ = {};
M_.orig_maximum_endo_lag = 1;
M_.orig_maximum_endo_lead = 1;
M_.orig_maximum_exo_lag = 0;
M_.orig_maximum_exo_lead = 0;
M_.orig_maximum_exo_det_lag = 0;
M_.orig_maximum_exo_det_lead = 0;
M_.orig_maximum_lag = 1;
M_.orig_maximum_lead = 1;
M_.orig_maximum_lag_with_diffs_expanded = 1;
M_.lead_lag_incidence = [
 0 7 0;
 1 8 0;
 2 9 0;
 0 10 0;
 0 11 0;
 0 12 0;
 0 13 0;
 0 14 27;
 0 15 28;
 3 16 0;
 0 17 0;
 0 18 0;
 0 19 0;
 0 20 0;
 0 21 29;
 4 22 0;
 5 23 0;
 6 24 0;
 0 25 0;
 0 26 30;]';
M_.nstatic = 10;
M_.nfwrd   = 4;
M_.npred   = 6;
M_.nboth   = 0;
M_.nsfwrd   = 4;
M_.nspred   = 6;
M_.ndynamic   = 10;
M_.dynamic_tmp_nbr = [1; 0; 0; 0; ];
M_.model_local_variables_dynamic_tt_idxs = {
};
M_.equations_tags = {
  1 , 'name' , '1' ;
  2 , 'name' , '2' ;
  3 , 'name' , '3' ;
  4 , 'name' , '4' ;
  5 , 'name' , '5' ;
  6 , 'name' , '6' ;
  7 , 'name' , 'pi_c' ;
  8 , 'name' , 'pi' ;
  9 , 'name' , 'y' ;
  10 , 'name' , 'g' ;
  11 , 'name' , 'tau' ;
  12 , 'name' , 'purchases1' ;
  13 , 'name' , 'purchases2' ;
  14 , 'name' , 'g1' ;
  15 , 'name' , 'g2' ;
  16 , 'name' , 'federalpurchases' ;
  17 , 'name' , 'pi2' ;
  18 , 'name' , 'pi1' ;
  19 , 'name' , '19' ;
  20 , 'name' , 'g_output' ;
};
M_.mapping.federalpurchases.eqidx = [16 ];
M_.mapping.purchases1.eqidx = [12 14 16 ];
M_.mapping.purchases2.eqidx = [13 15 16 ];
M_.mapping.g1.eqidx = [1 10 14 ];
M_.mapping.g2.eqidx = [2 10 15 ];
M_.mapping.y1.eqidx = [1 3 9 ];
M_.mapping.y2.eqidx = [2 4 9 ];
M_.mapping.pi1.eqidx = [3 7 8 11 18 ];
M_.mapping.pi2.eqidx = [4 7 8 11 17 ];
M_.mapping.tau.eqidx = [1 2 3 4 11 ];
M_.mapping.y.eqidx = [9 ];
M_.mapping.g.eqidx = [10 20 ];
M_.mapping.pi.eqidx = [8 ];
M_.mapping.i.eqidx = [5 6 ];
M_.mapping.c.eqidx = [1 2 3 4 6 ];
M_.mapping.p_c.eqidx = [19 ];
M_.mapping.p2.eqidx = [17 ];
M_.mapping.p1.eqidx = [18 ];
M_.mapping.g_output.eqidx = [20 ];
M_.mapping.pi_c.eqidx = [5 6 7 19 ];
M_.mapping.eps_g1.eqidx = [12 ];
M_.mapping.eps_g2.eqidx = [13 ];
M_.static_and_dynamic_models_differ = false;
M_.has_external_function = false;
M_.state_var = [2 3 10 16 17 18 ];
M_.exo_names_orig_ord = [1:2];
M_.maximum_lag = 1;
M_.maximum_lead = 1;
M_.maximum_endo_lag = 1;
M_.maximum_endo_lead = 1;
oo_.steady_state = zeros(20, 1);
M_.maximum_exo_lag = 0;
M_.maximum_exo_lead = 0;
oo_.exo_steady_state = zeros(2, 1);
M_.params = NaN(16, 1);
M_.endo_trends = struct('deflator', cell(20, 1), 'log_deflator', cell(20, 1), 'growth_factor', cell(20, 1), 'log_growth_factor', cell(20, 1));
M_.NNZDerivatives = [64; -1; -1; ];
M_.static_tmp_nbr = [1; 0; 0; 0; ];
M_.model_local_variables_static_tt_idxs = {
};
M_.params(8) = 4;
varphi = M_.params(8);
M_.params(9) = 0.997;
beta = M_.params(9);
M_.params(7) = 1;
sigma = M_.params(7);
M_.params(10) = 1.5;
phi_pi = M_.params(10);
M_.params(13) = 1;
eta = M_.params(13);
M_.params(14) = 1;
taylor = M_.params(14);
M_.params(15) = .1;
std1 = M_.params(15);
M_.params(16) = .1;
std2 = M_.params(16);
M_.params(5) = .65;
rho_g1 = M_.params(5);
M_.params(6) = .73;
rho_g2 = M_.params(6);
M_.params(11) = .78;
alpha1 = M_.params(11);
M_.params(12) = .89;
alpha2 = M_.params(12);
M_.params(2) = .2;
gy = M_.params(2);
M_.params(3) = 1-M_.params(2);
zeta = M_.params(3);
M_.params(4) = 0.26;
gamma = M_.params(4);
M_.params(1) = 0.65;
n = M_.params(1);
%
% SHOCKS instructions
%
M_.exo_det_length = 0;
M_.Sigma_e(1, 1) = 1;
M_.Sigma_e(2, 2) = 1;
oo_.dr.eigval = check(M_,options_,oo_);
options_.irf = 25;
options_.nodisplay = true;
options_.nofunctions = true;
options_.order = 1;
options_.periods = 200;
var_list_ = {};
[info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list_);


oo_.time = toc(tic0);
disp(['Total computing time : ' dynsec2hms(oo_.time) ]);
if ~exist([M_.dname filesep 'Output'],'dir')
    mkdir(M_.dname,'Output');
end
save([M_.dname filesep 'Output' filesep 'modelG_results.mat'], 'oo_', 'M_', 'options_');
if exist('estim_params_', 'var') == 1
  save([M_.dname filesep 'Output' filesep 'modelG_results.mat'], 'estim_params_', '-append');
end
if exist('bayestopt_', 'var') == 1
  save([M_.dname filesep 'Output' filesep 'modelG_results.mat'], 'bayestopt_', '-append');
end
if exist('dataset_', 'var') == 1
  save([M_.dname filesep 'Output' filesep 'modelG_results.mat'], 'dataset_', '-append');
end
if exist('estimation_info', 'var') == 1
  save([M_.dname filesep 'Output' filesep 'modelG_results.mat'], 'estimation_info', '-append');
end
if exist('dataset_info', 'var') == 1
  save([M_.dname filesep 'Output' filesep 'modelG_results.mat'], 'dataset_info', '-append');
end
if exist('oo_recursive_', 'var') == 1
  save([M_.dname filesep 'Output' filesep 'modelG_results.mat'], 'oo_recursive_', '-append');
end
if ~isempty(lastwarn)
  disp('Note: warning(s) encountered in MATLAB/Octave code')
end
